package atguigu.quartz;

import org.quartz.*;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

// 自定义一个任务

public class TestJob2 implements Job {

    @Override
    public void execute(JobExecutionContext jobExecutionContext) {
        JobDetail jobDetail = jobExecutionContext.getJobDetail();
        JobDataMap jobDataMap = jobDetail.getJobDataMap();
        jobDataMap.forEach((k,v)->{
            System.out.println(k+" "+v);
        });
        String data = LocalDateTime.now()
            .format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
        System.out.println("开始备份数据，时间 ：" + data);
    }
}